
//  #include "cm_time.h"



#ifndef __CM_TIME_H__
#define __CM_TIME_H__



#include <stdint.h>  


#define SECOND_OF_DAY (24*60*60)

#define TIMER_MIN_INTERVAL  (5)     //5ms
#define TIMER_INTERVAL_CNT  (2)     //2
#define TIMER_PERIOD_MS     (TIMER_MIN_INTERVAL*TIMER_INTERVAL_CNT)//10ms




typedef struct cm_tm {
    uint32_t tm_sec; /* 秒 – 取值区间为[0,59] */   
    uint32_t tm_min; /* 分 - 取值区间为[0,59] */
    uint32_t tm_hour; /* 时 - 取值区间为[0,23] */
    uint32_t tm_mday; /* 一个月中的日期 - 取值区间为[1,31] */
    uint32_t tm_mon; /* 月份 */
    uint32_t tm_year; /* 年份 */
}cm_tm_t;

extern const char * weekday_str[];

//extern volatile uint32_t gtime_ms;

// #define time_intval(base)  ((gtime_ms>=base)?(gtime_ms-base):(0xffffffff - base + gtime_ms + 1))
// #define get_runtime()      (gtime_ms) 



 uint32_t time_intval(uint32_t base) ;
 uint32_t get_runtime(void) ;
 uint32_t get_runtime_sec(void) ;



////时间戳转换为日期格式
void cm_sec_to_date(uint32_t lSec, cm_tm_t *tTime);

uint8_t cm_time_to_weekday(cm_tm_t *t);


 void cm_timer_callback_10ms(void );



#endif     /////__CM_TIME_H__




